<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="apple-mobile-web-app-capable" content="yes" />
		<meta name="apple-touch-fullscreen" content="yes" />
		<meta name="format-detection" content="telephone=no"/>
		<meta name="apple-mobile-web-app-status-bar-style" content="black" /> 
		<meta name="msapplication-tap-highlight" content="no" />
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, width=device-width, viewport-fit=cover" />
		<title>启蒙优选-收益明细</title>
		<link rel="stylesheet" href="__TMPL__/home/public/assets/css/style.css" />
		<link rel="stylesheet" href="__TMPL__/home/public/assets/css/swiper.min.css">
	</head>
	<style>
		.moreList{text-align: center;font-size:.72rem;color:#666;line-height:2.5rem;display: none;}
	</style>
	<body>
		<!-- 收益明细 --> 
		<div class="profitIndex">
			<div class="content">
				<div class="order_top">
					<div class="order_tab flex juscbtween">
						<a href="/award_list?type=1"><span <if condition="$type eq 1">  class="on" </if>>订单收益</span></a>
						<a href="/award_list?type=2"><span <if condition="$type eq 2">  class="on" </if>>管理奖励</span></a>
						<a href="/award_list?type=3"><span <if condition="$type eq 3">  class="on" </if>>培育奖励</span></a>
						<a href="/award_list?type=4"><span <if condition="$type eq 4">  class="on" </if>>分红奖励</span></a>
					</div>
					<div class="profit flex juscbtween">
						
						<if condition="$type eq 1 OR $type eq 2">
							<p>订单确认收货后立即结算收益</p>
						<elseif condition="$type eq 3">
							<p>每培养一个直属星级顾问最高奖励10000元</p>
						<else />
							<p>每月20号结算上月分红奖励</p>
						</if>
						<img src="__TMPL__/home/public/assets/img/user/right.png" alt="">
					</div>
				</div>
				<!-- 订单列表 -->
				<div class="order_list">
					<!-- 订单收益 -->
					<if condition="$type eq 1 OR $type eq 2">
						<div class="thisList">
							<foreach name="list" item="vo">
								<a href="/course_details?course_id={$vo.course_id}&invite_code={$invite}" class="order_item">
									<div class="top flex juscbtween">
										<div class="left flex alitemCenter">
											<img src="{$vo.logo}" alt="">
											<div class="userInfo">
												<h4>{$vo.nickname}</h4>
												<p>{$vo.pay_add_time}下单</p>
											</div>
										</div>
										<div class="right">
											<if condition="$vo.status eq 1">
													待结算
											<elseif condition="$vo.status eq 2">
												已结算
											<else />
												已失效
											</if>

										</div>
									</div>

									<div class="order_info flex juscbtween">
										<div class="order_img">
											<img src="{$vo.xt_logo}" alt="">
										</div>
										<div class="right flex flexdirection juscbtweenOnly">
											<h4 class="ellipsis">{$vo.title}</h4>
											<div class="money flex juscbtween">
												<div class="pay_money">
													<p><i>￥</i>{$vo.pay_money}</p>
													<span>付款金额</span>
												</div>
												<div class="get_money">
													<p><i>￥</i>{$vo.money}</p>
													<span>预估收益</span>
												</div>
											</div>
										</div>
									</div>
								</a>
							</foreach>
						</div>
						<div class="moreList">正在加载</div>
					<else />
						<!--<a href="javascript:;" class="profit_item">
							<div class="flex juscbtween">
								<h3>2020年6月直属导师培育奖</h3>
								<h4><i>￥</i>6666.00</h4>
							</div>
							<div class="flex juscbtween">
								<p>2020-02-02 12:0:02</p>
								<span>已到账</span>
							</div>
						</a>-->
					</if>
				</div>
				<php>
				  $counts = count($list);
				  if($counts <= 0){
				</php>
					<div class="noHaveData">
						<img src="__TMPL__/home/public/assets/img/noHaveOrder.png" alt="">
						<p>暂无数据</p>
					</div>
				<php>}</php>
			</div>
		</div>
	</body>
	<script rel="stylesheet" src="__TMPL__/home/public/assets/js/jquery-2.0.3.min.js"></script>
  	<script rel="stylesheet" src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
  	<script rel="stylesheet" src="__TMPL__/home/public/assets/js/base.js"></script>
	<script>
		$(function(){
		    //上拉加载
		    var pageNum = 1;
		    var type = {$type}||1;
			$(window).scroll(function () {
			    //滚动条滚动时调用
			    var scrollTop = $(this).scrollTop(); //计算已经卷进去滚动条的的高度
			    var scrollHeight = $(document).height(); //当前页面的总高度
			    var windowHeight = $(this).height(); //当前window的高度
			    if (scrollTop+3 + windowHeight >= scrollHeight) {
			    	$('.moreList').show();
			    	pageNum += 1;
				    $.ajax({
				      	url: '/award_list',
				      	type: 'post',
				      	data: {
				      		'page':pageNum,
				      		'type':type
				      	},
				      	success: function success(d) {
				      		console.log(d)
				      		if(d.code == 200){
					      		if(d.data){
					      			var htm = '';
					      			for(let i=0;i<d.data.list.length;i++){
					      				const item = d.data.list[i];
					      				htm += `
											<a href="/course_details?course_id=`+item.course_id+`&invite_code=`+d.data.invite+`" class="order_item">
												<div class="top flex juscbtween">
													<div class="left flex alitemCenter">
														<img src="`+item.logo+`" alt="">
														<div class="userInfo">
															<h4>`+item.nickname+`</h4>
															<p>`+item.pay_add_time+`下单</p>
														</div>
													</div>
													<div class="right">`+(item.status==1?"待结算":item.status==2?"已结算":"已失效")+`

													</div>
												</div>
												<div class="order_info flex juscbtween">
													<div class="order_img">
														<img src="__TMPL__/home/public/assets/img/head.jpeg" alt="">
													</div>
													<div class="right flex flexdirection juscbtweenOnly">
														<h4 class="ellipsis">`+item.title+`</h4>
														<div class="money flex juscbtween">
															<div class="pay_money">
																<p><i>￥</i>`+item.pay_money+`</p>
																<span>付款金额</span>
															</div>
															<div class="get_money">
																<p><i>￥</i>`+item.money+`</p>
																<span>预估收益</span>
															</div>
														</div>
													</div>
												</div>
											</a>`;
					      			}
					      			$('.thisList').append(htm);
					      		}
				      		}
				      		$('.moreList').html('没有更多了')
				      	},
				      	error: function error(e) {
				        	console.log(e);
				      	}
				    })
			    }
			});
		})
	</script>
</html>
